package DaEr2_1;

import java.util.Scanner;

public class NianLing {
    public static void main(String[] args) {
        int ny,nm,nd,by,bm,bd;
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入现在的年份:");
        ny= scanner.nextInt();
        System.out.println("请输入现在的月份:");
        nm= scanner.nextInt();
        System.out.println("请输入现在的日期:");
        nd= scanner.nextInt();
        System.out.println("请输入你生日的年份:");
        by= scanner.nextInt();
        System.out.println("请输入你生日的月份:");
        bm= scanner.nextInt();
        System.out.println("请输入你生日的日期:");
        bd= scanner.nextInt();
        int age=ny-by;
        if (nm<=bm){
            age--;
        }
        if (nm==bm&&nd<=bd){
            age--;
        }
        System.out.println("age = " + age);
    }
}
